<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    
    <title>使用DWR框架实现省市区联动</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<script type='text/javascript' src='/AJAXDemo/dwr/interface/pca.js'></script>
	<script type='text/javascript' src='/AJAXDemo/dwr/engine.js'></script>
	<script type='text/javascript' src='/AJAXDemo/dwr/util.js'></script>
	<script type="text/javascript">
		function postProvSend() {
			pca.getProv(function backProv(json) {
				DWRUtil.addOptions("prov",json,"id","name")
			});
		}
		
		function postCitySend(provid) {
			pca.getCity(provid,function backCity(json) {
				DWRUtil.removeAllOptions("city");
				DWRUtil.addOptions("city",json,"id","name")
			});
		}
		
		function postAreaSend(cityid) {
			pca.getArea(cityid,function backArea(json) {
				DWRUtil.removeAllOptions("area");
				DWRUtil.addOptions("area",json,"id","name")
			});
		}
	</script>
  </head>
  
  <body onload="postProvSend()"	>
  	<span>省</span><select id="prov" onchange="postCitySend(this.value)"><option value="-1">请选择</option></select>&nbsp;&nbsp;&nbsp;
  	<span>市</span><select id="city" onchange="postAreaSend(this.value)"><option value="-1">请选择</option></select>&nbsp;&nbsp;&nbsp;
  	<span>区</span><select id="area"><option value="-1">请选择</option></select>
  </body>
</html>
